#include <stdio.h>
#include <time.h>
#include<dirent.h>

int main(int argc, char *argv){
	char sysCommand[100];
	time_t start, end;
	double dif;
	time(&start);
	DIR *dir;
	struct dirent *ent;
		dir = opendir ("/home/nirandi/Xen/Lenny");
	if (dir != NULL) {

	  /* print all the files and directories within directory */
	  while ((ent = readdir (dir)) != NULL) {
	   // printf ("%s\n", ent->d_name);
		sprintf(sysCommand, "sha1sum /home/nirandi/Xen/Lenny/%s >> hashlistLenny",ent->d_name);
		system(sysCommand);
	  }
	  closedir (dir);
	} else {
	  /* could not open directory */
	  perror ("");
	  return 0;
	}

	
	time(&end);
	dif= difftime(end,start);
	printf("time to hash %.2lf seconds \n",dif);

}
